package com.song.auth.controller;

import com.song.common.domain.dto.LoginDto;
import com.song.common.response.DaoCaoResult;
import com.song.common.service.IUmsAuthService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("auth")
public class AuthController {

    private final IUmsAuthService authService;

    public AuthController(IUmsAuthService authService) {
        this.authService = authService;
    }

    @PostMapping
    public DaoCaoResult login(@RequestBody LoginDto loginDto) {

        String token = authService.login(loginDto);
        return DaoCaoResult.success("登录成功！", token);
    }

}
